package parallelism;

import fitness.Fitness;

import java.util.concurrent.Callable;

import model.OligoSystemGeneral;

import optimizers.commons.GAConstants;
import optimizers.commons.GAIndiv;

public class SystemFitnessEvaluationTask implements Callable<Object> {
	private int index;
	private OligoSystemGeneral indiv;
	private Fitness myFitnessEval;

	public SystemFitnessEvaluationTask(int i, OligoSystemGeneral indiv,
			Fitness myFitnessEval) {
		this.index = i;
		this.indiv = indiv;
		this.myFitnessEval = myFitnessEval;
	}

	public Object call() {
		fitness.FitnessResult result = null;
		result = (GAConstants.COMPLEX_FITNESS ? myFitnessEval
				.evaluateFitness(indiv) : myFitnessEval
				.evaluateFitnessSimple(indiv));
		return new SystemFitnessResult(index, result, 0);
	}
}